<template>
    <header class="home-header">
        <div class="left">
            <div class="btn" @click="goMenu">进入菜单</div>
        </div>
        <div class="center">
            <span>起重机智能安全保障平台</span>
            <span>crane intelligence safeguard platform</span>
        </div>
        <div class="right">
            <div class="time">
                <span class="time-item">{{ time }}</span>
                <span class="day">{{ day }}</span>
            </div>
        </div>
    </header>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";
import dayjs from "dayjs";

const router = useRouter();
const day = getDays();
const time = ref("");
setInterval(() => {
    time.value = dayjs().format("YYYY-MM-DD HH:mm:ss");
}, 1000);
function getDays() {
    const day = dayjs().day();
    const dayMap = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
    return dayMap[day];
}
const goMenu = () => {
    router.push("/main/conditionMonitoring");
    document.body.style = "";
};
</script>

<style lang="less" scoped>
.home-header {
    position: relative;
    z-index: 14;
    display: flex;
    justify-content: space-between;
    font-size: 16px;
    color: #fff;
    .left {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        padding-right: 20px;
        width: 628px;
        height: 50px;
        background: url("@/assets/image/home/home-aside.png") center/100% no-repeat;
        transform: scale(-1, 1);
        .btn {
            width: 90px;
            height: 24px;
            line-height: 24px;
            text-align: center;
            border: 1px solid #4ba6dd;
            color: #4ba6dd;
            cursor: pointer;
            transform: scale(-1, 1);
        }
    }
    .center {
        display: flex;
        flex-direction: column;
        width: 700px;
        height: 80px;
        text-align: center;
        background: url("@/assets/image/home/home-title-bg.png") center/100% no-repeat;
        span {
            &:first-child {
                font-size: 36px;
                font-family: PangMenZhengDao;
                background: linear-gradient(180deg, #ffffff 0%, #a8deff 100%);
                background-clip: text;
                -webkit-background-clip: text;
                -webkit-text-fill-color: transparent;
            }
            &:last-child {
                font-size: 14px;
                letter-spacing: 4px;
                text-shadow: 0px 2px 3px rgba(0, 0, 0, 0.84), 0px 0px 5px #25a9f6;
            }
        }
    }
    .right {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding-right: 22px;
        width: 628px;
        height: 50px;
        background: url("@/assets/image/home/home-aside.png") center/100% no-repeat;
        .time {
            .time-item {
                display: inline-block;
                width: 180px;
                text-align: center;
            }
            .day {
                margin-left: 10px;
                color: #4ba6dd;
            }
        }
    }
}
</style>
